package com.lzkj.baotouhousingfund.di.module;


import com.lzkj.baotouhousingfund.app.App;
import com.lzkj.baotouhousingfund.http.RetrofitHelper;
import com.lzkj.baotouhousingfund.http.api.ApiInterface;
import com.lzkj.baotouhousingfund.model.db.RealmHelper;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * Created by Chengs on 2017/4/2.
 */
@Module
public class AppModule {
    private final App mApp;

    public AppModule(App app) {
        mApp = app;
    }

    @Provides
    @Singleton
    App provideApplicationContext() {
        return mApp;
    }

    @Provides
    @Singleton
    RetrofitHelper provideRetrofitHelper(ApiInterface apiInterface) {
        return new RetrofitHelper(apiInterface);
    }

    @Provides
    @Singleton
    RealmHelper provideRealmHelper() {
        return new RealmHelper(mApp);
    }
}
